<template>
	<view class="right-view">
		<view
			v-if="current.bid === 0 && current.mid === 0"
			class="right-item logo"
		>
			<image :src="current.binfo.logo" class="logo-img" />
		</view>
		<view
			v-if="current.bid === 0 && current.mid !== 0"
			class="right-item logo"
			@tap="gotourl"
			:data-url="'/pagesExt/mingpian/index?id='+current.mid"
		>
			<image :src="current.binfo.logo" class="logo-img" />
		</view>
		<view
			v-if="current.bid !== 0"
			class="right-item logo"
			@tap="gotourl"
			:data-url="'/pages/business/index?id=' + current.bid"
		>
			<image :src="current.binfo.logo" class="logo-img" />
		</view>
		<view class="right-item">
			<image class="right-item__icon" src="/static/img/shortvideo_view.png" />
			<text class="right-item__text">{{current.view_num}}</text>
		</view>
		<view class="right-item" @tap="$emit('dozan')">
			<image
				:src="current.iszan ? '/static/img/shortvideo_like2.png' : '/static/img/shortvideo_like.png'"
				class="right-item__icon"
			/>
			<text class="right-item__text">{{current.zan_num}}</text>
		</view>
		<view class="right-item" v-if="current.comment === 1" @click="$emit('comment')">
			<image src="/static/img/shortvideo_comment.png" class="right-item__icon" />
			<text class="right-item__text">{{current.commentnum}}</text>
		</view>
		<view class="right-item" @click="$emit('fullscreen')">
			<image src="/static/img/fullscreen.png" class="right-item__icon" />
		</view>
		<!-- <view class="right-item" @click="$emit('share')">
			<image src="/static/img/shortvideo_share.png" class="right-item__icon" />
		</view> -->
		<view class="right-item" v-if="platform == 'app'">
			<image src="/static/img/shortvideo_share.png" class="right-item__icon" />
		</view>
		<view class="right-item" v-else-if="platform == 'mp'">
			<image src="/static/img/shortvideo_share.png" class="right-item__icon" />
		</view>
		<button class="right-item" open-type="share" hover-class="none" v-else-if="platform != 'h5'">
			<image src="/static/img/shortvideo_share.png" class="right-item__icon" />
		</button>
		<view v-if="sysset.can_upload === 1" class="right-item">
			<view class="add" :data-url="'uploadvideo?bid=' + current.bid" @tap="goto">
				<view class="add-hline"></view>
				<view class="add-vline"></view>
			</view>
		</view>
		<!-- <view v-if="current.linkurl" class="right-item">
			<view class="linkurl" @tap="gotourl" :data-url="current.linkurl">
				<text class="linkurl-txt">{{current.linkname}}</text>
				<image src="/static/img/shortvideo_arrowright.png" class="linkurl-img" />
			</view>
		</view>
		<view v-if="current.pronum > 0" class="right-item" @click="$emit('cart')">
			<image :src="preUrl+'/static/img/shortvideo_cart.png'" class="right-item__icon" />
			<text class="right-item__text cart-txt">{{current.pronum}}</text>
		</view> -->
	</view>
</template>

<script>
	const app = getApp()
	
	export default {
		props: {
			current: Object,
			sysset: Object,
		},
		data() {
			return {
				platform: app.globalData.platform,
				preUrl: app.globalData.pre_url,
			}
		},
		methods: {
			gotourl(e) {
				getApp().goto(e.currentTarget.dataset.url, e.currentTarget.dataset.opentype)
			},
			shareapp() {
				const videoinfo = this.current
				uni.showActionSheet({
					itemList: ['发送给微信好友', '分享到微信朋友圈'],
					success: (res) => {
						if (res.tapIndex >= 0) {
							const scene = 'WXSceneSession';
							if (res.tapIndex == 1) {
								scene = 'WXSenceTimeline';
							}
							const sharedata = {};
							sharedata.provider = 'weixin';
							sharedata.type = 0;
							sharedata.scene = scene;
							sharedata.title = videoinfo.name;
							sharedata.summary = videoinfo.description;
							sharedata.href = app.globalData.pre_url + '/h5/' + app.globalData.aid +
								'.html#/activity/shortvideo/detail?scene=id_' + videoinfo.id + '-pid_' +
								app.globalData.mid;
							sharedata.imageUrl = videoinfo.coverimg;
							const sharelist = app.globalData.initdata.sharelist;
							if (sharelist) {
								for (var i = 0; i < sharelist.length; i++) {
									if (sharelist[i]['indexurl'] == '/activity/shortvideo/detail') {
										sharedata.title = sharelist[i].title;
										sharedata.summary = sharelist[i].desc;
										sharedata.imageUrl = sharelist[i].pic;
										if (sharelist[i].url) {
											var sharelink = sharelist[i].url;
											if (sharelink.indexOf('/') === 0) {
												sharelink = app.globalData.pre_url + '/h5/' + app
													.globalData.aid + '.html#' + sharelink;
											}
											if (app.globalData.mid > 0) {
												sharelink += (sharelink.indexOf('?') === -1 ? '?' : '&') +
													'pid=' + app.globalData.mid;
											}
											sharedata.href = sharelink;
										}
									}
								}
							}
							uni.share(sharedata);
						}
					}
				});
			},
			sharemp() {
				app.error('点击右上角发送给好友或分享到朋友圈');
				this.$emit('close')
			},
		}
	}
</script>

<style lang="scss" scoped>
	.right-view {
		position: absolute;
		right: 20rpx;
		// bottom: 230rpx;
		bottom: 20rpx;
		align-items: center;
	}
	.right-item {
		padding: 16rpx 0;
		align-items: center;
		&__icon {
			width: 72rpx;
			height: 72rpx;
		}
		&__text {
			font-size: 24rpx;
			color: #fff;
		}
	}
	.logo {
		padding: 0;
		margin-bottom: 16rpx;
		width: 90rpx;
		height: 90rpx;
		border-radius: 50rpx;
		border: 4rpx solid #FFFFFF;
		// background: linear-gradient(180deg, #FF2775 0%, #FF2F4B 100%);
	}
	.logo-img {
		width: 86rpx;
		height: 86rpx;
		border-radius: 43rpx;
	}
	
	// .linkurl {
	// 	flex-direction: row;
	// 	align-items: center;
	// 	margin-right: -20rpx;
	// 	background: rgba(100, 100, 100, 0.5);
	// 	padding: 10rpx 0 10rpx 20rpx;
	// 	border-radius: 30rpx 0 0 30rpx
	// }
	
	// .linkurl-img {
	// 	width: 36rpx;
	// 	height: 36rpx
	// }
	
	// .linkurl-txt {
	// 	font-size: 26rpx;
	// 	color: #fff;
	// }
	
	// .cart-txt {
	// 	position: absolute;
	// 	bottom: 18rpx;
	// 	color: #fff;
	// 	width: 88rpx;
	// 	text-align: center;
	// 	font-size: 26rpx;
	// 	font-weight: bold
	// }
	
	.add {
		width: 72rpx;
		height: 72rpx;
		border-radius: 60rpx;
		background-image: linear-gradient(to right, #EE5D4B, #EB4A38);
		&-hline,
		&-vline {
			position: absolute;
			left: 36rpx;
			top: 36rpx;
			border-radius: 6rpx;
			background-color: #fff;
		}
		&-hline {
			width: 36rpx;
			height: 6rpx;
			margin-left: -18rpx;
			margin-top: -3rpx;
		}
		&-vline {
			width: 6rpx;
			height: 36rpx;
			margin-left: -3rpx;
			margin-top: -18rpx;
		}
	}
</style>